package org.skynet.spring.model;

import io.mybatis.provider.Entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.apache.ibatis.type.JdbcType;
import org.tools.bedrock.annotations.Inherit;

import java.util.Date;

/**
 * @author xietao
 * @version 1.0
 * @description 自动生成实体基础对象
 * @scope all
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
// 允许子类继承私有属性
@Inherit
// 链式调用
@Accessors(chain = true)
public class BaseBean {

    @Entity.Column(value = "id", id = true, remark = "唯一标识", updatable = false, insertable = false)
    private Long id;

    @Entity.Column(value = "pid", remark = "父id")
    private Long pid;

    @Entity.Column(value = "bid", remark = "业务id")
    private String bid;

    @Entity.Column(value = "sfid", remark = "雪花id")
    private String sfid;

    @Entity.Column(value = "uuid", remark = "uuid")
    private String uuid;

    @Entity.Column(value = "sort", remark = "排序")
    private Long sort;

    @Entity.Column(value = "state", remark = "状态;0 有效，1 失效")
    private Boolean state;

    @Entity.Column(value = "remark", remark = "备注")
    private String remark;

    @Entity.Column(value = "created_by", remark = "创建人")
    private String createdBy;

    @Entity.Column(value = "created_time", remark = "创建时间", jdbcType = JdbcType.TIMESTAMP)
    private Date createdTime;

    @Entity.Column(value = "updated_by", remark = "更新人")
    private String updatedBy;

    @Entity.Column(value = "updated_time", remark = "更新时间", jdbcType = JdbcType.TIMESTAMP)
    private Date updatedTime;

    @Override
    public String toString() {
        return "id='" + id + '\'' +
                ", pid='" + pid + '\'' +
                ", bid='" + bid + '\'' +
                ", sfid='" + sfid + '\'' +
                ", uuid='" + uuid + '\'' +
                ", sort='" + sort + '\'' +
                ", state=" + state +
                ", createdBy='" + createdBy + '\'' +
                ", createdTime=" + createdTime +
                ", updatedBy='" + updatedBy + '\'' +
                ", updatedTime=" + updatedTime;
    }

}
